<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CmResponseLog extends Migrator
{

    public function change()
    {
        $table = $this->table('cm_response_log', ['auto_increment' => true, 'limit' => 10, 'signed' => false]);
        $table->addColumn('http_code', 'string', ['limit' => 255, 'default' => ''])
            ->addColumn('method', 'string', ['limit' => 255, 'default' => '', 'comment' => '请求方式'])
            ->addColumn('route_prefix', 'string', ['limit' => 255, 'default' => '', 'comment' => '路由前缀（命名空间）'])
            ->addColumn('route_name', 'string', ['limit' => 255, 'default' => '', 'comment' => '路由名称(类名@方法名)'])
            ->addColumn('request_path', 'string', ['limit' => 255, 'default' => '', 'comment' => '请求地址'])
            ->addColumn('middleware', 'string', ['limit' => 255, 'default' => '', 'comment' => '中间件'])
            ->addColumn('header_data', 'string', ['limit' => 255, 'default' => '', 'comment' => 'header数据'])
            ->addColumn('request_data', 'string', ['limit' => 255, 'default' => '', 'comment' => '请求数据'])
            ->addColumn('response_data', 'string', ['limit' => 255, 'default' => '', 'comment' => '响应数据'])
            ->addColumn('response_time', 'datetime', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '响应时间'])
            ->addColumn('create_time', 'datetime', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '记录创建时间'])
            ->create();
    }
}
